local skel = fk.CreateSkill {
  name = "lb__qieqie",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable {
  ["lb__qieqie"] = "怯怯",
  [":lb__qieqie"] = "<b>锁定技</b>，当一张伤害牌不因<a href=':lb__qianshen'><font color='red'>〖遣神〗</font></a>被你使用或指定你为目标后，你获得<a href=':lb__weiling'><font color='red'>〖尾灵〗</font></a>直到此牌结算完成。",

  ["$lb__qieqie1"] = "说不定我也能做到…",
  ["$lb__qieqie2"] = "不要啊救命啊——",
  ["$lb__qieqie3"] = "尾巴救救！",
  ["$lb__qieqie4"] = "你、你们不要过来啊…",
}

local qieqie_spec = {
  mute = true,
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and not player:hasSkill("lb__weiling", true) and player == target
        and data.card.is_damage_card and not (data.extra_data and data.extra_data.lb__qianshen)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event == fk.CardUsing then
      room:notifySkillInvoked(player, skel.name, "offensive")
      player:broadcastSkillInvoke(skel.name, 1)
    else
      room:notifySkillInvoked(player, skel.name, "defensive")
      player:broadcastSkillInvoke(skel.name, math.random(2, 4))
    end
    room:handleAddLoseSkills(player, "lb__weiling", nil, true, false)
    room.logic:getCurrentEvent():findParent(GameEvent.UseCard, true):addCleaner(function()
      room:handleAddLoseSkills(player, "-lb__weiling", nil, true, false)
    end)
  end,
}

skel:addEffect(fk.CardUsing, qieqie_spec)
skel:addEffect(fk.TargetConfirmed, qieqie_spec)

return skel
